# -*- coding: utf-8 -*-
"""
    urls
    ~~~~

    URL definitions.

    :copyright: 2010 by Baptiste Lepilleur.
    :license: Apache License 2.0, see LICENSE.txt for more details.
"""
from tipfy import Rule


def get_rules(app):
    """Returns a list of URL rules for the WebBuildBot application.

    :param app:
        The WSGI application instance.
    :return:
        A list of class:`tipfy.Rule` instances.
    """
    rules = [
        Rule('/', endpoint='home', handler='apps.webbuildbot.ui.ProjectListHandler'),
        Rule('/scheduler/on_source_change/<source_change_key_name>',
            endpoint='scheduler_on_source_change',
            handler='apps.webbuildbot.scheduler.OnSourceChangeHandler'),
        Rule('/scheduler/assign_task/<agent_id>/source_change/<source_change_key_name>',
            endpoint='scheduler_assign_source_change_task',
            handler='apps.webbuildbot.scheduler.AssignSourceChangeTaskHandler'),
        Rule('/project/<project_slug>/trigger/googlecode',
            endpoint='googlecode_trigger',
            handler='apps.webbuildbot.triggers.GoogleCodeHandler'),
        Rule('/project',
            endpoint='project_list',
            handler='apps.webbuildbot.ui.ProjectListHandler'),
        Rule('/project/new',
            endpoint='new_project',
            handler='apps.webbuildbot.ui.EditProjectHandler'),
        Rule('/project/<slug_name>/',
            endpoint='view_project',
            handler='apps.webbuildbot.ui.ViewProjectHandler'),
        Rule('/project/edit_project_action',
            endpoint='edit_project_action',
            handler='apps.webbuildbot.ui.EditProjectHandler'),
        Rule('/pretty', endpoint='hello-world-pretty', handler='apps.hello_world.handlers.PrettyHelloWorldHandler'),
        Rule('/_ah/mail/<to_email_address>',
            endpoint='mail/incoming',
            handler='apps.webbuildbot.triggers.IncomingMailHandler' ),
        Rule('/<who>', endpoint='hello-world', handler='apps.hello_world.handlers.HelloWorldHandler'),
    ]

    return rules
